#include "FriendStation.h"

void Ignore(){
  char dum[100];
  scanf("%[^'#']",dum);
  scanf("%*c");
  }
  
int Load (MemberList *L){
  /* Kamus */
  char katatemp1[100]="";
  char katatemp2[100]="";
  
  /* Algoritma */
  CreateMemberList(*L);
  STARTKATA();
  if(FILEKU=='\0'){
    printf("File tidak ditemukan\n");
    return 1;
	}
  else{
    while((retval==1)&&(strpos(CKata.TabKata,"@user")==-1)) ADVKATA();
    /* Baca @user */
	while((retval==1)&&(strpos(CKata.TabKata,"@friend")==-1)){
	  ADVKATA();
	  strcat(katatemp1,CKata.TabKata);
	  if((!EOP())&&(strlen(CKata.TabKata)!=0)) strcat(katatemp1," ");
	  else{
		if(strpos(katatemp1,"@friend")==-1) AddUser(*L,katatemp1);
  		EndKata = false;
	    ADV();
		strcpy(katatemp1,"\0");
		ADVKATA();
		}
	  }
	/* Baca @friend */
	while((retval==1)&&(strpos(CKata.TabKata,"@end")==-1)){
	  ADVKATA();
	  strcpy(katatemp1,CKata.TabKata);
	  ADVKATA(); ADVKATA();
	  strcpy(katatemp2,CKata.TabKata);
	  if(strpos(katatemp1,"@end")==-1) Friend(katatemp1,katatemp2);
	  }
	return 0;
	}
  }